import { Model } from 'pinia-orm';
import { Attr, Str, Uid, Num, Bool, HasOne, HasMany, BelongsTo, HasManyBy, BelongsToMany, MorphOne,
  MorphTo, MorphMany, MorphToMany, OnDelete
  } from 'pinia-orm/decorators';
import { useAxiosRepo } from '@pinia-orm/axios';
import { useAppConfig } from '@vben/hooks';
import type { UserWalletLog, UserWalletLogResponse } from '../../views/uctoo/user_wallet_log/types.js';
//#region Human-Code Preservation

//#endregion Human-Code Preservation

const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);

export class uctoo_user_wallet_log extends Model {
  static override entity = 'uctoo_user_wallet_log'

@Uid() declare id: string 
@Uid() declare user_id: string 
@Num(0) declare wallet: number | null
@Str('') declare type: string 
@Str('') declare wallet_type: string 
@Uid() declare item_id: string | null
@Str('') declare ext_info: string | null
@Str('') declare oper_type: string 
@Uid() declare oper_id: string | null
@Uid() declare creator: string | null
@Attr('') declare created_at: string 
@Attr('') declare updated_at: string 
@Attr('') declare deleted_at: string | null


  static override config = {
    axiosApi: {
        actions: {
            getuctooUserWalletLogList(page: number, pageSize: number, searchParams?: any){
                return useAxiosRepo(uctoo_user_wallet_log).api().get(`/uctoo/user_wallet_log/${pageSize}/${page}`, {
                  params: searchParams,
                  headers: { 'Content-Type': 'application/json;charset=utf-8',
                          'Authorization': `Bearer ${localStorage.getItem('accessToken')}` 
                  },
                  baseURL: apiURL,
                  dataKey: 'userWalletLogs'
                })
            },
            getuctooUserWalletLog(id: string){
              return useAxiosRepo(uctoo_user_wallet_log).api().get(`/uctoo/user_wallet_log/${id}`, {
                headers: { 'Content-Type': 'application/json;charset=utf-8',
                        'Authorization': `Bearer ${localStorage.getItem('accessToken')}` 
                },
                baseURL: apiURL,
              })
            },
            adductooUserWalletLog(data: Partial<UserWalletLog>){
              return useAxiosRepo(uctoo_user_wallet_log).api().post('/uctoo/user_wallet_log/add', data, {
                headers: { 'Content-Type': 'application/json;charset=utf-8',
                        'Authorization': `Bearer ${localStorage.getItem('accessToken')}` 
                },
                baseURL: apiURL,
              })
            },
            edituctooUserWalletLog(data: any){
              return useAxiosRepo(uctoo_user_wallet_log).api().post('/uctoo/user_wallet_log/edit', data, {
                headers: { 'Content-Type': 'application/json;charset=utf-8',
                        'Authorization': `Bearer ${localStorage.getItem('accessToken')}` 
                },
                baseURL: apiURL,
              })
            },
            deleteuctooUserWalletLog(data: any){
              return useAxiosRepo(uctoo_user_wallet_log).api().post('/uctoo/user_wallet_log/del', data, {
                headers: { 'Content-Type': 'application/json;charset=utf-8',
                        'Authorization': `Bearer ${localStorage.getItem('accessToken')}` 
                },
                baseURL: apiURL,
              })
            },

//#region Human-Code Preservation

//#endregion Human-Code Preservation
        } 
    }
  }
}
